{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Usage of the TreeView package"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "using TreeView"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The `@tree` macro displays a given expression as a directed graph:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"96.911pt\" height=\"69.262pt\" viewBox=\"0 0 96.911 69.262\" version=\"1.1\">\n",
       "<defs>\n",
       "<g>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050698-0-0\">\n",
       "<path style=\"stroke:none;\" d=\"\"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050698-0-1\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.84375 -3.046875 C 4.84375 -3.40625 4.5 -3.40625 4.375 -3.40625 L 2.953125 -3.40625 L 2.953125 -4.828125 C 2.953125 -4.9375 2.953125 -5.296875 2.609375 -5.296875 C 2.265625 -5.296875 2.265625 -4.9375 2.265625 -4.828125 L 2.265625 -3.40625 L 0.84375 -3.40625 C 0.734375 -3.40625 0.375 -3.40625 0.375 -3.046875 C 0.375 -2.703125 0.734375 -2.703125 0.84375 -2.703125 L 2.265625 -2.703125 L 2.265625 -1.28125 C 2.265625 -1.15625 2.265625 -0.8125 2.609375 -0.8125 C 2.953125 -0.8125 2.953125 -1.15625 2.953125 -1.28125 L 2.953125 -2.703125 L 4.375 -2.703125 C 4.5 -2.703125 4.84375 -2.703125 4.84375 -3.046875 Z M 4.84375 -3.046875 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050698-0-2\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.9375 -0.296875 C 4.9375 -0.609375 4.6875 -0.609375 4.53125 -0.609375 L 4.140625 -0.609375 L 2.859375 -2.21875 L 4 -3.6875 L 4.390625 -3.6875 C 4.53125 -3.6875 4.8125 -3.6875 4.8125 -3.984375 C 4.8125 -4.296875 4.546875 -4.296875 4.390625 -4.296875 L 3.234375 -4.296875 C 3.078125 -4.296875 2.828125 -4.296875 2.828125 -4 C 2.828125 -3.6875 3.046875 -3.6875 3.3125 -3.6875 L 2.578125 -2.6875 L 1.828125 -3.6875 C 2.078125 -3.6875 2.296875 -3.6875 2.296875 -4 C 2.296875 -4.296875 2.046875 -4.296875 1.90625 -4.296875 L 0.734375 -4.296875 C 0.59375 -4.296875 0.328125 -4.296875 0.328125 -3.984375 C 0.328125 -3.6875 0.59375 -3.6875 0.734375 -3.6875 L 1.140625 -3.6875 L 2.3125 -2.21875 L 1.078125 -0.609375 L 0.671875 -0.609375 C 0.53125 -0.609375 0.265625 -0.609375 0.265625 -0.296875 C 0.265625 0 0.53125 0 0.671875 0 L 1.84375 0 C 2 0 2.25 0 2.25 -0.296875 C 2.25 -0.609375 2.03125 -0.609375 1.71875 -0.609375 L 2.578125 -1.828125 L 3.46875 -0.609375 C 3.1875 -0.609375 2.96875 -0.609375 2.96875 -0.296875 C 2.96875 0 3.21875 0 3.375 0 L 4.53125 0 C 4.671875 0 4.9375 0 4.9375 -0.296875 Z M 4.9375 -0.296875 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050698-0-3\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.703125 -0.40625 L 4.703125 -0.671875 C 4.703125 -0.859375 4.703125 -1.078125 4.359375 -1.078125 C 4.015625 -1.078125 4.015625 -0.890625 4.015625 -0.609375 L 1.640625 -0.609375 C 2.234375 -1.109375 3.1875 -1.859375 3.625 -2.265625 C 4.25 -2.828125 4.703125 -3.453125 4.703125 -4.25 C 4.703125 -5.453125 3.703125 -6.203125 2.484375 -6.203125 C 1.3125 -6.203125 0.515625 -5.390625 0.515625 -4.53125 C 0.515625 -4.171875 0.796875 -4.0625 0.96875 -4.0625 C 1.171875 -4.0625 1.40625 -4.234375 1.40625 -4.5 C 1.40625 -4.625 1.359375 -4.75 1.265625 -4.828125 C 1.421875 -5.28125 1.890625 -5.59375 2.4375 -5.59375 C 3.25 -5.59375 4.015625 -5.140625 4.015625 -4.25 C 4.015625 -3.5625 3.53125 -2.984375 2.875 -2.4375 L 0.671875 -0.578125 C 0.578125 -0.5 0.515625 -0.453125 0.515625 -0.3125 C 0.515625 0 0.765625 0 0.921875 0 L 4.3125 0 C 4.640625 0 4.703125 -0.09375 4.703125 -0.40625 Z M 4.703125 -0.40625 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050698-0-4\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.984375 -3.984375 C 4.984375 -4.296875 4.75 -4.296875 4.578125 -4.296875 L 3.421875 -4.296875 C 3.265625 -4.296875 3.015625 -4.296875 3.015625 -4 C 3.015625 -3.6875 3.265625 -3.6875 3.421875 -3.6875 L 3.703125 -3.6875 L 2.984375 -1.5625 C 2.84375 -1.203125 2.796875 -1.015625 2.71875 -0.703125 C 2.65625 -0.890625 2.578125 -1.109375 2.5 -1.296875 L 1.578125 -3.6875 L 1.828125 -3.6875 C 1.96875 -3.6875 2.21875 -3.6875 2.21875 -3.984375 C 2.21875 -4.296875 1.984375 -4.296875 1.828125 -4.296875 L 0.65625 -4.296875 C 0.5 -4.296875 0.265625 -4.296875 0.265625 -3.984375 C 0.265625 -3.6875 0.515625 -3.6875 0.65625 -3.6875 L 0.96875 -3.6875 L 2.375 -0.125 C 2.421875 -0.03125 2.421875 0 2.421875 0 C 2.421875 0 2.171875 0.84375 2.046875 1.09375 C 1.75 1.640625 1.390625 1.65625 1.25 1.671875 C 1.25 1.671875 1.296875 1.578125 1.296875 1.453125 C 1.296875 1.203125 1.109375 1.015625 0.875 1.015625 C 0.59375 1.015625 0.421875 1.203125 0.421875 1.453125 C 0.421875 1.875 0.765625 2.265625 1.25 2.265625 C 2.25 2.265625 2.703125 0.953125 2.734375 0.84375 L 4.28125 -3.6875 L 4.578125 -3.6875 C 4.734375 -3.6875 4.984375 -3.6875 4.984375 -3.984375 Z M 4.984375 -3.984375 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050698-1-0\">\n",
       "<path style=\"stroke:none;\" d=\"\"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050698-1-1\">\n",
       "<path style=\"stroke:none;\" d=\"M 5.59375 -5.828125 L 2.765625 -7.421875 L -0.046875 -5.828125 L 0.0625 -5.609375 L 2.765625 -6.828125 L 5.46875 -5.609375 Z M 5.59375 -5.828125 \"/>\n",
       "</symbol>\n",
       "</g>\n",
       "</defs>\n",
       "<g id=\"surface1\">\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -3.083906 -6.166813 L -10.357344 -20.709781 \" transform=\"matrix(1,0,0,-1,48.455,5.966)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.19508 1.592791 C -1.097256 0.995333 0.00156727 0.0991379 0.300295 -0.000440961 C -0.000181444 -0.0982675 -1.097274 -0.99619 -1.195109 -1.595393 \" transform=\"matrix(-0.4472,0.89442,0.89442,0.4472,38.09953,26.67692)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 3.084063 -6.166813 L 10.353594 -20.709781 \" transform=\"matrix(1,0,0,-1,48.455,5.966)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.195039 1.595533 C -1.097204 0.99633 -0.000111567 0.0984072 0.300365 0.000580717 C 0.00163715 -0.0989981 -1.097186 -0.995193 -1.19501 -1.592651 \" transform=\"matrix(0.4472,0.89442,0.89442,-0.4472,58.81047,26.67692)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -20.462812 -34.635563 L -36.529219 -50.701969 \" transform=\"matrix(1,0,0,-1,48.455,5.966)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.196683 1.593301 C -1.097245 0.996674 -0.000666455 0.0989711 0.297647 -0.000466695 C -0.000666455 -0.0999045 -1.097245 -0.997607 -1.196683 -1.594234 \" transform=\"matrix(-0.7071,0.7071,0.7071,0.7071,11.92564,56.66877)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -14.17375 -35.573063 L -14.17375 -49.616031 \" transform=\"matrix(1,0,0,-1,48.455,5.966)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.196361 1.59339 C -1.094799 0.995734 -0.00104875 0.101202 0.299733 -0.00036 C -0.00104875 -0.0980163 -1.094799 -0.996454 -1.196361 -1.59411 \" transform=\"matrix(0,1,1,0,34.28161,55.58308)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 14.173906 -35.573063 L 14.173906 -49.432438 \" transform=\"matrix(1,0,0,-1,48.455,5.966)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.195665 1.594266 C -1.094102 0.99661 -0.0003525 0.0981725 0.300429 0.00051625 C -0.0003525 -0.101046 -1.094102 -0.995577 -1.195665 -1.593234 \" transform=\"matrix(0,1,1,0,62.62839,55.39879)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 20.462969 -34.635563 L 36.060625 -50.233219 \" transform=\"matrix(1,0,0,-1,48.455,5.966)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.197265 1.594331 C -1.095065 0.994941 -0.00124894 0.100001 0.297065 0.000563039 C -0.00124894 -0.0988748 -1.097827 -0.996578 -1.197265 -1.593205 \" transform=\"matrix(0.7071,0.7071,0.7071,-0.7071,84.51611,56.2005)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050698-0-1\" x=\"45.84\" y=\"8.611\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050698-1-1\" x=\"31.513\" y=\"38.018\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050698-0-2\" x=\"3.321\" y=\"64.806\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050698-0-3\" x=\"31.667\" y=\"65.757\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050698-1-1\" x=\"59.859\" y=\"38.018\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050698-0-4\" x=\"60.013\" y=\"63.67\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050698-0-3\" x=\"88.36\" y=\"65.757\"/>\n",
       "</g>\n",
       "</g>\n",
       "</svg>\n",
       "\n"
      ],
      "text/plain": [
       "TreeView.LabelledTree({7, 6} directed graph,Any[:+,:^,:x,2,:^,:y,2])"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "@tree x^2 + y^2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"40.218pt\" height=\"69.69pt\" viewBox=\"0 0 40.218 69.69\" version=\"1.1\">\n",
       "<defs>\n",
       "<g>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050700-0-0\">\n",
       "<path style=\"stroke:none;\" d=\"\"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050700-0-1\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.359375 -5.546875 C 4.359375 -6.15625 3.5625 -6.15625 3.40625 -6.15625 C 2.609375 -6.15625 1.828125 -5.6875 1.828125 -4.828125 L 1.828125 -4.296875 L 0.84375 -4.296875 C 0.671875 -4.296875 0.421875 -4.296875 0.421875 -3.984375 C 0.421875 -3.6875 0.671875 -3.6875 0.828125 -3.6875 L 1.828125 -3.6875 L 1.828125 -0.609375 L 0.828125 -0.609375 C 0.671875 -0.609375 0.421875 -0.609375 0.421875 -0.3125 C 0.421875 0 0.671875 0 0.828125 0 L 3.53125 0 C 3.671875 0 3.9375 0 3.9375 -0.296875 C 3.9375 -0.609375 3.671875 -0.609375 3.53125 -0.609375 L 2.515625 -0.609375 L 2.515625 -3.6875 L 3.734375 -3.6875 C 3.890625 -3.6875 4.140625 -3.6875 4.140625 -3.984375 C 4.140625 -4.296875 3.890625 -4.296875 3.734375 -4.296875 L 2.515625 -4.296875 L 2.515625 -4.765625 C 2.515625 -5.546875 3.1875 -5.546875 3.484375 -5.546875 C 3.484375 -5.5 3.578125 -5.109375 3.921875 -5.109375 C 4.125 -5.109375 4.359375 -5.28125 4.359375 -5.546875 Z M 4.359375 -5.546875 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050700-0-2\">\n",
       "<path style=\"stroke:none;\" d=\"M 5.078125 -3.875 C 5.078125 -4.09375 4.890625 -4.40625 4.34375 -4.40625 C 4.234375 -4.40625 3.75 -4.390625 3.296875 -4.0625 C 3.125 -4.171875 2.78125 -4.359375 2.328125 -4.359375 C 1.390625 -4.359375 0.671875 -3.609375 0.671875 -2.765625 C 0.671875 -2.328125 0.84375 -2 1 -1.8125 C 0.890625 -1.65625 0.796875 -1.4375 0.796875 -1.140625 C 0.796875 -0.78125 0.9375 -0.53125 1.03125 -0.421875 C 0.296875 0.03125 0.296875 0.703125 0.296875 0.8125 C 0.296875 1.671875 1.328125 2.28125 2.609375 2.28125 C 3.890625 2.28125 4.9375 1.671875 4.9375 0.8125 C 4.9375 0.453125 4.75 -0.046875 4.25 -0.3125 C 4.109375 -0.390625 3.703125 -0.609375 2.796875 -0.609375 L 2.109375 -0.609375 C 2.03125 -0.609375 1.890625 -0.609375 1.8125 -0.625 C 1.671875 -0.625 1.609375 -0.625 1.484375 -0.765625 C 1.375 -0.90625 1.359375 -1.125 1.359375 -1.125 C 1.359375 -1.171875 1.390625 -1.3125 1.421875 -1.40625 C 1.453125 -1.390625 1.828125 -1.15625 2.328125 -1.15625 C 3.234375 -1.15625 3.96875 -1.875 3.96875 -2.765625 C 3.96875 -3.0625 3.875 -3.34375 3.703125 -3.625 C 3.921875 -3.75 4.15625 -3.78125 4.28125 -3.796875 C 4.34375 -3.53125 4.578125 -3.453125 4.671875 -3.453125 C 4.84375 -3.453125 5.078125 -3.578125 5.078125 -3.875 Z M 3.28125 -2.765625 C 3.28125 -2.1875 2.84375 -1.75 2.328125 -1.75 C 1.78125 -1.75 1.359375 -2.21875 1.359375 -2.75 C 1.359375 -3.3125 1.796875 -3.765625 2.328125 -3.765625 C 2.859375 -3.765625 3.28125 -3.296875 3.28125 -2.765625 Z M 4.359375 0.8125 C 4.359375 1.25 3.609375 1.6875 2.609375 1.6875 C 1.609375 1.6875 0.875 1.25 0.875 0.8125 C 0.875 0.640625 0.953125 0.3125 1.28125 0.125 C 1.53125 -0.046875 1.609375 -0.046875 2.34375 -0.046875 C 3.234375 -0.046875 4.359375 -0.046875 4.359375 0.8125 Z M 4.359375 0.8125 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050700-0-3\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.9375 -0.296875 C 4.9375 -0.609375 4.6875 -0.609375 4.53125 -0.609375 L 4.140625 -0.609375 L 2.859375 -2.21875 L 4 -3.6875 L 4.390625 -3.6875 C 4.53125 -3.6875 4.8125 -3.6875 4.8125 -3.984375 C 4.8125 -4.296875 4.546875 -4.296875 4.390625 -4.296875 L 3.234375 -4.296875 C 3.078125 -4.296875 2.828125 -4.296875 2.828125 -4 C 2.828125 -3.6875 3.046875 -3.6875 3.3125 -3.6875 L 2.578125 -2.6875 L 1.828125 -3.6875 C 2.078125 -3.6875 2.296875 -3.6875 2.296875 -4 C 2.296875 -4.296875 2.046875 -4.296875 1.90625 -4.296875 L 0.734375 -4.296875 C 0.59375 -4.296875 0.328125 -4.296875 0.328125 -3.984375 C 0.328125 -3.6875 0.59375 -3.6875 0.734375 -3.6875 L 1.140625 -3.6875 L 2.3125 -2.21875 L 1.078125 -0.609375 L 0.671875 -0.609375 C 0.53125 -0.609375 0.265625 -0.609375 0.265625 -0.296875 C 0.265625 0 0.53125 0 0.671875 0 L 1.84375 0 C 2 0 2.25 0 2.25 -0.296875 C 2.25 -0.609375 2.03125 -0.609375 1.71875 -0.609375 L 2.578125 -1.828125 L 3.46875 -0.609375 C 3.1875 -0.609375 2.96875 -0.609375 2.96875 -0.296875 C 2.96875 0 3.21875 0 3.375 0 L 4.53125 0 C 4.671875 0 4.9375 0 4.9375 -0.296875 Z M 4.9375 -0.296875 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050700-0-4\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.984375 -3.984375 C 4.984375 -4.296875 4.75 -4.296875 4.578125 -4.296875 L 3.421875 -4.296875 C 3.265625 -4.296875 3.015625 -4.296875 3.015625 -4 C 3.015625 -3.6875 3.265625 -3.6875 3.421875 -3.6875 L 3.703125 -3.6875 L 2.984375 -1.5625 C 2.84375 -1.203125 2.796875 -1.015625 2.71875 -0.703125 C 2.65625 -0.890625 2.578125 -1.109375 2.5 -1.296875 L 1.578125 -3.6875 L 1.828125 -3.6875 C 1.96875 -3.6875 2.21875 -3.6875 2.21875 -3.984375 C 2.21875 -4.296875 1.984375 -4.296875 1.828125 -4.296875 L 0.65625 -4.296875 C 0.5 -4.296875 0.265625 -4.296875 0.265625 -3.984375 C 0.265625 -3.6875 0.515625 -3.6875 0.65625 -3.6875 L 0.96875 -3.6875 L 2.375 -0.125 C 2.421875 -0.03125 2.421875 0 2.421875 0 C 2.421875 0 2.171875 0.84375 2.046875 1.09375 C 1.75 1.640625 1.390625 1.65625 1.25 1.671875 C 1.25 1.671875 1.296875 1.578125 1.296875 1.453125 C 1.296875 1.203125 1.109375 1.015625 0.875 1.015625 C 0.59375 1.015625 0.421875 1.203125 0.421875 1.453125 C 0.421875 1.875 0.765625 2.265625 1.25 2.265625 C 2.25 2.265625 2.703125 0.953125 2.734375 0.84375 L 4.28125 -3.6875 L 4.578125 -3.6875 C 4.734375 -3.6875 4.984375 -3.6875 4.984375 -3.984375 Z M 4.984375 -3.984375 \"/>\n",
       "</symbol>\n",
       "</g>\n",
       "</defs>\n",
       "<g id=\"surface1\">\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 0.000375 -6.594281 L 0.000375 -21.027875 \" transform=\"matrix(1,0,0,-1,20.109,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.193617 1.594125 C -1.095961 0.996469 0.001695 0.0980312 0.29857 0.000375 C 0.001695 -0.101188 -1.095961 -0.995719 -1.193617 -1.593375 \" transform=\"matrix(0,1,1,0,20.109,27.42018)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -3.429313 -35.207563 L -11.136344 -50.617719 \" transform=\"matrix(1,0,0,-1,20.109,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.193647 1.594091 C -1.095803 0.996648 -0.000461041 0.098761 0.298265 -0.000805362 C -0.00220266 -0.0986409 -1.09575 -0.99484 -1.193561 -1.594035 \" transform=\"matrix(-0.44724,0.89442,0.89442,0.44724,8.97396,57.01093)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 3.430062 -35.207563 L 10.566781 -49.481 \" transform=\"matrix(1,0,0,-1,20.109,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.193926 1.593507 C -1.09647 0.996689 -0.000245454 0.100618 0.297297 -0.00029384 C -0.000240106 -0.0994818 -1.096417 -0.995612 -1.195581 -1.594175 \" transform=\"matrix(0.44897,0.898,0.898,-0.44897,30.67538,55.87352)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050700-0-1\" x=\"17.494\" y=\"9.467\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050700-0-2\" x=\"17.494\" y=\"35.801\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050700-0-3\" x=\"3.321\" y=\"65.234\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050700-0-4\" x=\"31.667\" y=\"64.098\"/>\n",
       "</g>\n",
       "</g>\n",
       "</svg>\n",
       "\n"
      ],
      "text/plain": [
       "TreeView.LabelledTree({4, 3} directed graph,Any[:f,:g,:x,:y])"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "@tree f(g(x, y))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"228.547pt\" height=\"126.199pt\" viewBox=\"0 0 228.547 126.199\" version=\"1.1\">\n",
       "<defs>\n",
       "<g>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050702-0-0\">\n",
       "<path style=\"stroke:none;\" d=\"\"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050702-0-1\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.859375 -2.15625 C 4.859375 -3.375 3.984375 -4.359375 2.921875 -4.359375 C 2.4375 -4.359375 2 -4.171875 1.65625 -3.875 L 1.65625 -5.6875 C 1.65625 -5.984375 1.59375 -6.09375 1.25 -6.09375 L 0.53125 -6.09375 C 0.375 -6.09375 0.125 -6.09375 0.125 -5.78125 C 0.125 -5.484375 0.375 -5.484375 0.515625 -5.484375 L 0.96875 -5.484375 L 0.96875 -0.40625 C 0.96875 -0.203125 0.96875 0 1.3125 0 C 1.65625 0 1.65625 -0.203125 1.65625 -0.453125 C 2.0625 -0.03125 2.5 0.0625 2.8125 0.0625 C 3.890625 0.0625 4.859375 -0.890625 4.859375 -2.15625 Z M 4.171875 -2.15625 C 4.171875 -1.203125 3.484375 -0.546875 2.78125 -0.546875 C 2 -0.546875 1.65625 -1.421875 1.65625 -1.90625 L 1.65625 -2.625 C 1.65625 -3.21875 2.234375 -3.75 2.859375 -3.75 C 3.59375 -3.75 4.171875 -3.015625 4.171875 -2.15625 Z M 4.171875 -2.15625 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050702-0-2\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.65625 -0.296875 C 4.65625 -0.609375 4.421875 -0.609375 4.25 -0.609375 L 2.953125 -0.609375 L 2.953125 -5.6875 C 2.953125 -5.984375 2.90625 -6.09375 2.5625 -6.09375 L 0.984375 -6.09375 C 0.828125 -6.09375 0.578125 -6.09375 0.578125 -5.78125 C 0.578125 -5.484375 0.84375 -5.484375 0.984375 -5.484375 L 2.265625 -5.484375 L 2.265625 -0.609375 L 0.984375 -0.609375 C 0.828125 -0.609375 0.578125 -0.609375 0.578125 -0.296875 C 0.578125 0 0.84375 0 0.984375 0 L 4.25 0 C 4.40625 0 4.65625 0 4.65625 -0.296875 Z M 4.65625 -0.296875 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050702-0-3\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.65625 -2.15625 C 4.65625 -3.40625 3.734375 -4.390625 2.609375 -4.390625 C 1.5 -4.390625 0.5625 -3.40625 0.5625 -2.15625 C 0.5625 -0.890625 1.515625 0.0625 2.609375 0.0625 C 3.703125 0.0625 4.65625 -0.890625 4.65625 -2.15625 Z M 3.96875 -2.21875 C 3.96875 -1.296875 3.34375 -0.546875 2.609375 -0.546875 C 1.875 -0.546875 1.25 -1.296875 1.25 -2.21875 C 1.25 -3.125 1.90625 -3.78125 2.609375 -3.78125 C 3.328125 -3.78125 3.96875 -3.125 3.96875 -2.21875 Z M 3.96875 -2.21875 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050702-0-4\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.640625 -1.09375 C 4.640625 -1.359375 4.359375 -1.359375 4.296875 -1.359375 C 4.140625 -1.359375 4.03125 -1.34375 3.96875 -1.140625 C 3.90625 -1.015625 3.71875 -0.546875 2.984375 -0.546875 C 2.140625 -0.546875 1.421875 -1.25 1.421875 -2.15625 C 1.421875 -2.625 1.6875 -3.78125 3.046875 -3.78125 C 3.25 -3.78125 3.640625 -3.78125 3.640625 -3.6875 C 3.65625 -3.34375 3.84375 -3.203125 4.078125 -3.203125 C 4.3125 -3.203125 4.53125 -3.375 4.53125 -3.65625 C 4.53125 -4.390625 3.484375 -4.390625 3.046875 -4.390625 C 1.328125 -4.390625 0.734375 -3.03125 0.734375 -2.15625 C 0.734375 -0.953125 1.671875 0.0625 2.921875 0.0625 C 4.3125 0.0625 4.640625 -0.921875 4.640625 -1.09375 Z M 4.640625 -1.09375 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050702-0-5\">\n",
       "<path style=\"stroke:none;\" d=\"M 5.0625 -0.296875 C 5.0625 -0.609375 4.8125 -0.609375 4.65625 -0.609375 L 4.34375 -0.609375 L 2.859375 -2.546875 L 4.09375 -3.6875 L 4.4375 -3.6875 C 4.578125 -3.6875 4.84375 -3.6875 4.84375 -3.984375 C 4.84375 -4.296875 4.578125 -4.296875 4.4375 -4.296875 L 2.90625 -4.296875 C 2.734375 -4.296875 2.5 -4.296875 2.5 -3.984375 C 2.5 -3.6875 2.75 -3.6875 2.90625 -3.6875 L 3.265625 -3.6875 L 1.65625 -2.171875 L 1.65625 -5.6875 C 1.65625 -5.984375 1.59375 -6.09375 1.25 -6.09375 L 0.609375 -6.09375 C 0.453125 -6.09375 0.203125 -6.09375 0.203125 -5.796875 C 0.203125 -5.484375 0.453125 -5.484375 0.609375 -5.484375 L 1.09375 -5.484375 L 1.09375 -0.609375 L 0.609375 -0.609375 C 0.453125 -0.609375 0.203125 -0.609375 0.203125 -0.3125 C 0.203125 0 0.453125 0 0.609375 0 L 2.140625 0 C 2.296875 0 2.546875 0 2.546875 -0.296875 C 2.546875 -0.609375 2.296875 -0.609375 2.140625 -0.609375 L 1.65625 -0.609375 L 1.65625 -1.421875 L 2.453125 -2.15625 L 3.640625 -0.609375 C 3.28125 -0.609375 3.078125 -0.609375 3.078125 -0.296875 C 3.078125 0 3.328125 0 3.484375 0 L 4.65625 0 C 4.8125 0 5.0625 0 5.0625 -0.296875 Z M 5.0625 -0.296875 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050702-0-6\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.53125 -0.296875 C 4.53125 -0.609375 4.28125 -0.609375 4.125 -0.609375 L 3.078125 -0.609375 L 3.078125 -3.890625 C 3.078125 -4.203125 3.015625 -4.296875 2.6875 -4.296875 L 1.265625 -4.296875 C 1.109375 -4.296875 0.859375 -4.296875 0.859375 -4 C 0.859375 -3.6875 1.109375 -3.6875 1.265625 -3.6875 L 2.390625 -3.6875 L 2.390625 -0.609375 L 1.1875 -0.609375 C 1.03125 -0.609375 0.78125 -0.609375 0.78125 -0.296875 C 0.78125 0 1.03125 0 1.1875 0 L 4.125 0 C 4.28125 0 4.53125 0 4.53125 -0.296875 Z M 3.125 -5.53125 C 3.125 -5.8125 2.90625 -6.03125 2.625 -6.03125 C 2.34375 -6.03125 2.125 -5.8125 2.125 -5.53125 C 2.125 -5.25 2.34375 -5.03125 2.625 -5.03125 C 2.90625 -5.03125 3.125 -5.25 3.125 -5.53125 Z M 3.125 -5.53125 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050702-0-7\">\n",
       "<path style=\"stroke:none;\" d=\"M 5.109375 -0.296875 C 5.109375 -0.609375 4.859375 -0.609375 4.6875 -0.609375 L 4.25 -0.609375 L 4.25 -2.921875 C 4.25 -3.921875 3.75 -4.359375 2.953125 -4.359375 C 2.296875 -4.359375 1.84375 -4.015625 1.65625 -3.828125 C 1.65625 -4.140625 1.65625 -4.296875 1.25 -4.296875 L 0.53125 -4.296875 C 0.375 -4.296875 0.125 -4.296875 0.125 -3.984375 C 0.125 -3.6875 0.375 -3.6875 0.515625 -3.6875 L 0.96875 -3.6875 L 0.96875 -0.609375 L 0.53125 -0.609375 C 0.375 -0.609375 0.125 -0.609375 0.125 -0.296875 C 0.125 0 0.375 0 0.515625 0 L 2.109375 0 C 2.25 0 2.5 0 2.5 -0.296875 C 2.5 -0.609375 2.25 -0.609375 2.09375 -0.609375 L 1.65625 -0.609375 L 1.65625 -2.375 C 1.65625 -3.375 2.390625 -3.75 2.90625 -3.75 C 3.421875 -3.75 3.5625 -3.46875 3.5625 -2.875 L 3.5625 -0.609375 L 3.1875 -0.609375 C 3.015625 -0.609375 2.765625 -0.609375 2.765625 -0.296875 C 2.765625 0 3.046875 0 3.1875 0 L 4.703125 0 C 4.84375 0 5.109375 0 5.109375 -0.296875 Z M 5.109375 -0.296875 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050702-0-8\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.625 -1.09375 C 4.625 -1.359375 4.34375 -1.359375 4.28125 -1.359375 C 4.09375 -1.359375 4.015625 -1.328125 3.953125 -1.140625 C 3.734375 -0.640625 3.1875 -0.546875 2.90625 -0.546875 C 2.15625 -0.546875 1.421875 -1.046875 1.25 -1.90625 L 4.234375 -1.90625 C 4.4375 -1.90625 4.625 -1.90625 4.625 -2.265625 C 4.625 -3.40625 3.984375 -4.390625 2.6875 -4.390625 C 1.5 -4.390625 0.546875 -3.390625 0.546875 -2.15625 C 0.546875 -0.953125 1.5625 0.0625 2.84375 0.0625 C 4.15625 0.0625 4.625 -0.84375 4.625 -1.09375 Z M 3.921875 -2.5 L 1.265625 -2.5 C 1.40625 -3.234375 2 -3.78125 2.6875 -3.78125 C 3.203125 -3.78125 3.828125 -3.53125 3.921875 -2.5 Z M 3.921875 -2.5 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050702-0-9\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.703125 -0.40625 L 4.703125 -0.671875 C 4.703125 -0.859375 4.703125 -1.078125 4.359375 -1.078125 C 4.015625 -1.078125 4.015625 -0.890625 4.015625 -0.609375 L 1.640625 -0.609375 C 2.234375 -1.109375 3.1875 -1.859375 3.625 -2.265625 C 4.25 -2.828125 4.703125 -3.453125 4.703125 -4.25 C 4.703125 -5.453125 3.703125 -6.203125 2.484375 -6.203125 C 1.3125 -6.203125 0.515625 -5.390625 0.515625 -4.53125 C 0.515625 -4.171875 0.796875 -4.0625 0.96875 -4.0625 C 1.171875 -4.0625 1.40625 -4.234375 1.40625 -4.5 C 1.40625 -4.625 1.359375 -4.75 1.265625 -4.828125 C 1.421875 -5.28125 1.890625 -5.59375 2.4375 -5.59375 C 3.25 -5.59375 4.015625 -5.140625 4.015625 -4.25 C 4.015625 -3.5625 3.53125 -2.984375 2.875 -2.4375 L 0.671875 -0.578125 C 0.578125 -0.5 0.515625 -0.453125 0.515625 -0.3125 C 0.515625 0 0.765625 0 0.921875 0 L 4.3125 0 C 4.640625 0 4.703125 -0.09375 4.703125 -0.40625 Z M 4.703125 -0.40625 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050702-0-10\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.453125 -0.296875 C 4.453125 -0.609375 4.1875 -0.609375 4.03125 -0.609375 L 2.953125 -0.609375 L 2.953125 -5.484375 L 4.03125 -5.484375 C 4.1875 -5.484375 4.453125 -5.484375 4.453125 -5.78125 C 4.453125 -6.09375 4.1875 -6.09375 4.03125 -6.09375 L 1.203125 -6.09375 C 1.046875 -6.09375 0.78125 -6.09375 0.78125 -5.796875 C 0.78125 -5.484375 1.046875 -5.484375 1.203125 -5.484375 L 2.265625 -5.484375 L 2.265625 -0.609375 L 1.203125 -0.609375 C 1.046875 -0.609375 0.78125 -0.609375 0.78125 -0.3125 C 0.78125 0 1.046875 0 1.203125 0 L 4.03125 0 C 4.1875 0 4.453125 0 4.453125 -0.296875 Z M 4.453125 -0.296875 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050702-0-11\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.8125 0.53125 C 4.8125 0.21875 4.578125 0.21875 4.421875 0.21875 L 2.90625 0.21875 L 2.90625 -6.3125 L 4.421875 -6.3125 C 4.5625 -6.3125 4.8125 -6.3125 4.8125 -6.609375 C 4.8125 -6.921875 4.578125 -6.921875 4.421875 -6.921875 L 2.609375 -6.921875 C 2.28125 -6.921875 2.21875 -6.828125 2.21875 -6.515625 L 2.21875 0.421875 C 2.21875 0.734375 2.265625 0.828125 2.609375 0.828125 L 4.421875 0.828125 C 4.5625 0.828125 4.8125 0.828125 4.8125 0.53125 Z M 4.8125 0.53125 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050702-0-12\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.78125 -5.78125 C 4.78125 -6.09375 4.546875 -6.09375 4.390625 -6.09375 L 1.09375 -6.09375 C 1.03125 -6.25 0.859375 -6.25 0.78125 -6.25 C 0.4375 -6.25 0.4375 -6.03125 0.4375 -5.84375 L 0.4375 -5.421875 C 0.4375 -5.234375 0.4375 -5.015625 0.78125 -5.015625 C 1.125 -5.015625 1.125 -5.203125 1.125 -5.484375 L 3.765625 -5.484375 C 2.03125 -3.65625 1.6875 -1.453125 1.6875 -0.359375 C 1.6875 -0.21875 1.6875 0.109375 2.046875 0.109375 C 2.21875 0.109375 2.375 0 2.375 -0.296875 C 2.4375 -3.125 3.953125 -4.859375 4.5625 -5.4375 C 4.765625 -5.625 4.78125 -5.640625 4.78125 -5.78125 Z M 4.78125 -5.78125 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050702-0-13\">\n",
       "<path style=\"stroke:none;\" d=\"M 3.015625 0.421875 L 3.015625 -6.515625 C 3.015625 -6.8125 2.953125 -6.921875 2.609375 -6.921875 L 0.8125 -6.921875 C 0.65625 -6.921875 0.40625 -6.921875 0.40625 -6.625 C 0.40625 -6.3125 0.640625 -6.3125 0.8125 -6.3125 L 2.328125 -6.3125 L 2.328125 0.21875 L 0.8125 0.21875 C 0.65625 0.21875 0.40625 0.21875 0.40625 0.515625 C 0.40625 0.828125 0.640625 0.828125 0.8125 0.828125 L 2.609375 0.828125 C 2.9375 0.828125 3.015625 0.734375 3.015625 0.421875 Z M 3.015625 0.421875 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050702-0-14\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.84375 -3.8125 C 4.84375 -4.15625 4.46875 -4.15625 4.34375 -4.15625 L 0.890625 -4.15625 C 0.75 -4.15625 0.375 -4.15625 0.375 -3.8125 C 0.375 -3.453125 0.703125 -3.453125 0.828125 -3.453125 L 4.390625 -3.453125 C 4.515625 -3.453125 4.84375 -3.453125 4.84375 -3.8125 Z M 4.84375 -2.296875 C 4.84375 -2.640625 4.515625 -2.640625 4.390625 -2.640625 L 0.828125 -2.640625 C 0.703125 -2.640625 0.375 -2.640625 0.375 -2.296875 C 0.375 -1.9375 0.75 -1.9375 0.890625 -1.9375 L 4.34375 -1.9375 C 4.46875 -1.9375 4.84375 -1.9375 4.84375 -2.296875 Z M 4.84375 -2.296875 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050702-0-15\">\n",
       "<path style=\"stroke:none;\" d=\"M 5.171875 -0.3125 C 5.171875 -0.609375 4.921875 -0.609375 4.78125 -0.609375 C 4.359375 -0.609375 4.25 -0.65625 4.171875 -0.6875 L 4.171875 -2.84375 C 4.171875 -3.546875 3.640625 -4.390625 2.203125 -4.390625 C 1.78125 -4.390625 0.75 -4.390625 0.75 -3.65625 C 0.75 -3.359375 0.96875 -3.203125 1.203125 -3.203125 C 1.359375 -3.203125 1.640625 -3.296875 1.640625 -3.65625 C 1.640625 -3.734375 1.65625 -3.75 1.859375 -3.765625 C 2 -3.78125 2.125 -3.78125 2.21875 -3.78125 C 2.96875 -3.78125 3.484375 -3.46875 3.484375 -2.765625 C 1.71875 -2.734375 0.5 -2.234375 0.5 -1.28125 C 0.5 -0.59375 1.125 0.0625 2.140625 0.0625 C 2.515625 0.0625 3.125 -0.015625 3.59375 -0.3125 C 3.8125 -0.015625 4.296875 0 4.671875 0 C 4.953125 0 5.171875 0 5.171875 -0.3125 Z M 3.484375 -1.328125 C 3.484375 -1.109375 3.484375 -0.890625 3.09375 -0.71875 C 2.734375 -0.546875 2.296875 -0.546875 2.21875 -0.546875 C 1.59375 -0.546875 1.1875 -0.890625 1.1875 -1.28125 C 1.1875 -1.765625 2.046875 -2.140625 3.484375 -2.171875 Z M 3.484375 -1.328125 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050702-0-16\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.84375 -3.046875 C 4.84375 -3.40625 4.5 -3.40625 4.375 -3.40625 L 2.953125 -3.40625 L 2.953125 -4.828125 C 2.953125 -4.9375 2.953125 -5.296875 2.609375 -5.296875 C 2.265625 -5.296875 2.265625 -4.9375 2.265625 -4.828125 L 2.265625 -3.40625 L 0.84375 -3.40625 C 0.734375 -3.40625 0.375 -3.40625 0.375 -3.046875 C 0.375 -2.703125 0.734375 -2.703125 0.84375 -2.703125 L 2.265625 -2.703125 L 2.265625 -1.28125 C 2.265625 -1.15625 2.265625 -0.8125 2.609375 -0.8125 C 2.953125 -0.8125 2.953125 -1.15625 2.953125 -1.28125 L 2.953125 -2.703125 L 4.375 -2.703125 C 4.5 -2.703125 4.84375 -2.703125 4.84375 -3.046875 Z M 4.84375 -3.046875 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050702-0-17\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.78125 -1.734375 C 4.78125 -2.4375 4.3125 -3.03125 3.65625 -3.328125 C 4.21875 -3.6875 4.5 -4.25 4.5 -4.796875 C 4.5 -5.53125 3.765625 -6.203125 2.625 -6.203125 C 1.421875 -6.203125 0.734375 -5.71875 0.734375 -5.03125 C 0.734375 -4.703125 0.984375 -4.5625 1.171875 -4.5625 C 1.390625 -4.5625 1.609375 -4.734375 1.609375 -5.015625 C 1.609375 -5.15625 1.5625 -5.25 1.53125 -5.28125 C 1.828125 -5.59375 2.546875 -5.59375 2.625 -5.59375 C 3.3125 -5.59375 3.8125 -5.234375 3.8125 -4.78125 C 3.8125 -4.484375 3.65625 -4.140625 3.390625 -3.921875 C 3.078125 -3.65625 2.828125 -3.640625 2.46875 -3.625 C 1.890625 -3.578125 1.75 -3.578125 1.75 -3.296875 C 1.75 -2.984375 1.984375 -2.984375 2.140625 -2.984375 L 2.609375 -2.984375 C 3.59375 -2.984375 4.09375 -2.3125 4.09375 -1.734375 C 4.09375 -1.125 3.53125 -0.5 2.625 -0.5 C 2.234375 -0.5 1.46875 -0.609375 1.203125 -1.078125 C 1.25 -1.125 1.328125 -1.1875 1.328125 -1.390625 C 1.328125 -1.625 1.140625 -1.828125 0.890625 -1.828125 C 0.65625 -1.828125 0.4375 -1.671875 0.4375 -1.359375 C 0.4375 -0.46875 1.40625 0.109375 2.625 0.109375 C 3.9375 0.109375 4.78125 -0.8125 4.78125 -1.734375 Z M 4.78125 -1.734375 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050702-0-18\">\n",
       "<path style=\"stroke:none;\" d=\"M 5.109375 -0.3125 C 5.109375 -0.609375 4.84375 -0.609375 4.703125 -0.609375 L 4.25 -0.609375 L 4.25 -5.6875 C 4.25 -5.984375 4.203125 -6.09375 3.859375 -6.09375 L 3.125 -6.09375 C 2.96875 -6.09375 2.71875 -6.09375 2.71875 -5.78125 C 2.71875 -5.484375 2.984375 -5.484375 3.125 -5.484375 L 3.5625 -5.484375 L 3.5625 -3.90625 C 3.234375 -4.203125 2.828125 -4.359375 2.40625 -4.359375 C 1.3125 -4.359375 0.359375 -3.40625 0.359375 -2.140625 C 0.359375 -0.90625 1.25 0.0625 2.3125 0.0625 C 2.875 0.0625 3.296875 -0.203125 3.5625 -0.5 C 3.5625 -0.140625 3.5625 0 3.96875 0 L 4.6875 0 C 4.859375 0 5.109375 0 5.109375 -0.3125 Z M 3.5625 -1.9375 C 3.5625 -1.375 3.125 -0.546875 2.359375 -0.546875 C 1.640625 -0.546875 1.046875 -1.25 1.046875 -2.140625 C 1.046875 -3.09375 1.75 -3.75 2.4375 -3.75 C 3.078125 -3.75 3.5625 -3.1875 3.5625 -2.640625 Z M 3.5625 -1.9375 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050702-0-19\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.671875 -3.046875 C 4.671875 -3.40625 4.3125 -3.40625 4.203125 -3.40625 L 1.03125 -3.40625 C 0.90625 -3.40625 0.5625 -3.40625 0.5625 -3.046875 C 0.5625 -2.703125 0.90625 -2.703125 1.03125 -2.703125 L 4.203125 -2.703125 C 4.3125 -2.703125 4.671875 -2.703125 4.671875 -3.046875 Z M 4.671875 -3.046875 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050702-1-0\">\n",
       "<path style=\"stroke:none;\" d=\"\"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050702-1-1\">\n",
       "<path style=\"stroke:none;\" d=\"M 5.59375 -5.828125 L 2.765625 -7.421875 L -0.046875 -5.828125 L 0.0625 -5.609375 L 2.765625 -6.828125 L 5.46875 -5.609375 Z M 5.59375 -5.828125 \"/>\n",
       "</symbol>\n",
       "</g>\n",
       "</defs>\n",
       "<g id=\"surface1\">\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -16.597156 -6.5435 L -57.479969 -22.664594 \" transform=\"matrix(1,0,0,-1,107.187,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.19408 1.59363 C -1.094103 0.996565 -0.00108511 0.100146 0.29855 -0.0012402 C -0.000824871 -0.10121 -1.095232 -0.994562 -1.196611 -1.591888 \" transform=\"matrix(-0.93166,0.36739,0.36739,0.93166,49.70829,29.05944)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -3.296375 -6.594281 L -11.167469 -22.336469 \" transform=\"matrix(1,0,0,-1,107.187,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.194149 1.592837 C -1.096725 0.997754 0.00119139 0.0981444 0.298729 -0.00104363 C -0.000553864 -0.0984757 -1.096778 -0.994547 -1.197714 -1.593105 \" transform=\"matrix(-0.44897,0.898,0.898,0.44897,96.01787,28.73221)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 3.297375 -6.594281 L 10.672375 -21.344281 \" transform=\"matrix(1,0,0,-1,107.187,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.194035 1.593404 C -1.094453 0.997695 -0.000854538 0.101519 0.297875 0.000198882 C -0.000852741 -0.0993799 -1.096182 -0.997322 -1.194006 -1.59478 \" transform=\"matrix(0.4472,0.89442,0.89442,-0.4472,117.8588,27.73757)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 16.59425 -6.453656 L 66.34425 -25.7935 \" transform=\"matrix(1,0,0,-1,107.187,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.194071 1.593124 C -1.095701 0.996194 0.00148422 0.0981121 0.298527 0.000486327 C -0.00115126 -0.0993158 -1.094026 -0.996438 -1.195303 -1.595773 \" transform=\"matrix(0.93478,0.36345,0.36345,-0.93478,173.52936,32.18883)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -78.71825 -34.941937 L -94.788562 -50.453656 \" transform=\"matrix(1,0,0,-1,107.187,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.194324 1.593249 C -1.095587 0.994352 0.000263007 0.0989556 0.299582 -0.000460734 C -0.00174596 -0.0994561 -1.096251 -0.997689 -1.195926 -1.594577 \" transform=\"matrix(-0.72139,0.69637,0.69637,0.72139,12.40003,56.8464)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -71.886219 -34.941937 L -71.886219 -48.844281 \" transform=\"matrix(1,0,0,-1,107.187,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.196001 1.593941 C -1.094439 0.996285 -0.00068875 0.0978475 0.300092 0.00019125 C -0.00068875 -0.101371 -1.094439 -0.995902 -1.196001 -1.593559 \" transform=\"matrix(0,1,1,0,35.30059,55.23897)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -19.769031 -33.941937 L -36.456531 -50.629437 \" transform=\"matrix(1,0,0,-1,107.187,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.193667 1.593304 C -1.094215 0.996697 -0.000404155 0.101813 0.300666 -0.000375978 C 0.00236363 -0.0998194 -1.096921 -0.994766 -1.193577 -1.594141 \" transform=\"matrix(-0.70714,0.7071,0.7071,0.70714,70.73241,57.02204)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -14.175281 -33.941937 L -14.175281 -50.070844 \" transform=\"matrix(1,0,0,-1,107.187,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.194869 1.595765 C -1.097213 0.998109 0.00044375 0.0996713 0.297319 -0.00189125 C 0.00044375 -0.0995475 -1.097213 -0.997985 -1.194869 -1.595641 \" transform=\"matrix(0,1,1,0,93.01361,56.4644)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -17.257312 -62.859906 L -24.84325 -78.035687 \" transform=\"matrix(1,0,0,-1,107.187,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.197463 1.59495 C -1.094819 0.998127 -0.00212263 0.100257 0.300635 -0.000671184 C 0.00135207 -0.0981032 -1.094872 -0.994174 -1.195809 -1.592732 \" transform=\"matrix(-0.44897,0.898,0.898,0.44897,82.34261,84.42955)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -11.089344 -62.859906 L -3.077625 -78.88725 \" transform=\"matrix(1,0,0,-1,107.187,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.195529 1.595777 C -1.097717 0.996581 -0.000676555 0.0986352 0.299791 0.000799731 C 0.00106507 -0.0987666 -1.094277 -0.996653 -1.195614 -1.59235 \" transform=\"matrix(0.44724,0.89442,0.89442,-0.44724,104.1113,85.283)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 14.172375 -34.941937 L 14.172375 -49.563031 \" transform=\"matrix(1,0,0,-1,107.187,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.194571 1.592735 C -1.096915 0.995079 0.00074125 0.100548 0.297616 -0.001015 C 0.00074125 -0.0986712 -1.096915 -0.997109 -1.194571 -1.594765 \" transform=\"matrix(0,1,1,0,121.36039,55.95629)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 21.004406 -34.941937 L 35.551281 -48.984906 \" transform=\"matrix(1,0,0,-1,107.187,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.19574 1.595488 C -1.096079 0.998581 -0.00156973 0.100292 0.299764 0.00128493 C 0.000433599 -0.0981256 -1.098276 -0.996221 -1.197032 -1.595132 \" transform=\"matrix(0.72139,0.69633,0.69633,-0.72139,142.73989,55.37813)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 72.90675 -33.941937 L 72.90675 -49.641156 \" transform=\"matrix(1,0,0,-1,107.187,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.196156 1.5947 C -1.094594 0.997044 -0.00084375 0.0986062 0.299937 0.00095 C -0.00084375 -0.100613 -1.094594 -0.995144 -1.196156 -1.5928 \" transform=\"matrix(0,1,1,0,180.0928,56.036)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 78.504406 -33.941937 L 94.637219 -50.078656 \" transform=\"matrix(1,0,0,-1,107.187,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.195577 1.59622 C -1.096139 0.994069 0.000439294 0.101891 0.298753 0.0024528 C -0.00232287 -0.0997472 -1.096139 -0.994688 -1.195577 -1.591315 \" transform=\"matrix(0.7071,0.7071,0.7071,-0.7071,201.82608,56.47408)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 97.641125 -63.9185 L 89.895031 -79.410687 \" transform=\"matrix(1,0,0,-1,107.187,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.197205 1.594697 C -1.094552 0.997881 -0.00184878 0.100039 0.300908 -0.000882974 C -0.00185057 -0.100059 -1.098049 -0.996142 -1.195494 -1.592956 \" transform=\"matrix(-0.44899,0.898,0.898,0.44899,197.08121,85.8044)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 104.863781 -63.9185 L 111.910656 -78.01225 \" transform=\"matrix(1,0,0,-1,107.187,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.194098 1.592696 C -1.096671 0.995888 -0.000510467 0.0997875 0.297021 -0.00113557 C -0.000514032 -0.100308 -1.096706 -0.996369 -1.195895 -1.594914 \" transform=\"matrix(0.44902,0.898,0.898,-0.44902,219.09812,84.40464)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 84.46925 -90.258344 L 75.980969 -107.234906 \" transform=\"matrix(1,0,0,-1,107.187,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.195825 1.592921 C -1.096646 0.994369 -0.000459911 0.0982806 0.300556 0.000841871 C -0.000459911 -0.101817 -1.096646 -0.997905 -1.194085 -1.594718 \" transform=\"matrix(-0.449,0.898,0.898,0.449,183.16935,113.62816)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 89.688 -90.258344 L 97.738781 -106.359906 \" transform=\"matrix(1,0,0,-1,107.187,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.194012 1.593073 C -1.094453 0.997371 -0.000906242 0.101172 0.297814 -0.000157248 C -0.000911633 -0.0997236 -1.096254 -0.99761 -1.194097 -1.595054 \" transform=\"matrix(0.44724,0.89442,0.89442,-0.44724,204.92554,112.75309)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-1\" x=\"94.111\" y=\"9.408\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-2\" x=\"99.341386\" y=\"9.408\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-3\" x=\"104.571772\" y=\"9.408\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-4\" x=\"109.802158\" y=\"9.408\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-5\" x=\"115.032544\" y=\"9.408\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-2\" x=\"24.841\" y=\"37.754\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-6\" x=\"30.071386\" y=\"37.754\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-7\" x=\"35.301772\" y=\"37.754\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-8\" x=\"40.532158\" y=\"37.754\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-9\" x=\"3.321\" y=\"66.186\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-10\" x=\"22.226\" y=\"66.131\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-7\" x=\"27.456386\" y=\"66.131\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-11\" x=\"32.686772\" y=\"66.131\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-12\" x=\"37.917158\" y=\"66.131\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-13\" x=\"43.147544\" y=\"66.131\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-14\" x=\"90.399\" y=\"36.818\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-15\" x=\"62.052\" y=\"65.249\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-16\" x=\"90.399\" y=\"65.732\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-1\" x=\"76.225\" y=\"94.447\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-4\" x=\"104.572\" y=\"93.596\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-2\" x=\"110.899\" y=\"37.754\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-6\" x=\"116.129386\" y=\"37.754\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-7\" x=\"121.359772\" y=\"37.754\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-8\" x=\"126.590158\" y=\"37.754\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-17\" x=\"118.745\" y=\"66.131\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-10\" x=\"137.65\" y=\"66.131\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-7\" x=\"142.880386\" y=\"66.131\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-11\" x=\"148.110772\" y=\"66.131\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-12\" x=\"153.341158\" y=\"66.131\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-13\" x=\"158.571544\" y=\"66.131\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-14\" x=\"177.477\" y=\"36.818\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-18\" x=\"177.477\" y=\"66.101\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050702-1-1\" x=\"205.669\" y=\"66.793\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-19\" x=\"191.65\" y=\"93.132\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-15\" x=\"177.477\" y=\"121.942\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-9\" x=\"205.823\" y=\"122.878\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050702-0-9\" x=\"219.996\" y=\"94.532\"/>\n",
       "</g>\n",
       "</g>\n",
       "</svg>\n",
       "\n"
      ],
      "text/plain": [
       "TreeView.LabelledTree({19, 18} directed graph,Any[:block,:line,2,Symbol(\"In[7]\"),:(=),:a,:+,:b,:c,:line,3,Symbol(\"In[7]\"),:(=),:d,:^,:-,:a,2,2])"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "@tree begin\n",
    "    a = b + c\n",
    "    d = (a - 2)^2\n",
    "end"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Internally, function calls in `Expr`essions are represented using nodes with `call`, which can also be visualized:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"153.758pt\" height=\"70.114pt\" viewBox=\"0 0 153.758 70.114\" version=\"1.1\">\n",
       "<defs>\n",
       "<g>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050699-0-0\">\n",
       "<path style=\"stroke:none;\" d=\"\"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050699-0-1\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.640625 -1.09375 C 4.640625 -1.359375 4.359375 -1.359375 4.296875 -1.359375 C 4.140625 -1.359375 4.03125 -1.34375 3.96875 -1.140625 C 3.90625 -1.015625 3.71875 -0.546875 2.984375 -0.546875 C 2.140625 -0.546875 1.421875 -1.25 1.421875 -2.15625 C 1.421875 -2.625 1.6875 -3.78125 3.046875 -3.78125 C 3.25 -3.78125 3.640625 -3.78125 3.640625 -3.6875 C 3.65625 -3.34375 3.84375 -3.203125 4.078125 -3.203125 C 4.3125 -3.203125 4.53125 -3.375 4.53125 -3.65625 C 4.53125 -4.390625 3.484375 -4.390625 3.046875 -4.390625 C 1.328125 -4.390625 0.734375 -3.03125 0.734375 -2.15625 C 0.734375 -0.953125 1.671875 0.0625 2.921875 0.0625 C 4.3125 0.0625 4.640625 -0.921875 4.640625 -1.09375 Z M 4.640625 -1.09375 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050699-0-2\">\n",
       "<path style=\"stroke:none;\" d=\"M 5.171875 -0.3125 C 5.171875 -0.609375 4.921875 -0.609375 4.78125 -0.609375 C 4.359375 -0.609375 4.25 -0.65625 4.171875 -0.6875 L 4.171875 -2.84375 C 4.171875 -3.546875 3.640625 -4.390625 2.203125 -4.390625 C 1.78125 -4.390625 0.75 -4.390625 0.75 -3.65625 C 0.75 -3.359375 0.96875 -3.203125 1.203125 -3.203125 C 1.359375 -3.203125 1.640625 -3.296875 1.640625 -3.65625 C 1.640625 -3.734375 1.65625 -3.75 1.859375 -3.765625 C 2 -3.78125 2.125 -3.78125 2.21875 -3.78125 C 2.96875 -3.78125 3.484375 -3.46875 3.484375 -2.765625 C 1.71875 -2.734375 0.5 -2.234375 0.5 -1.28125 C 0.5 -0.59375 1.125 0.0625 2.140625 0.0625 C 2.515625 0.0625 3.125 -0.015625 3.59375 -0.3125 C 3.8125 -0.015625 4.296875 0 4.671875 0 C 4.953125 0 5.171875 0 5.171875 -0.3125 Z M 3.484375 -1.328125 C 3.484375 -1.109375 3.484375 -0.890625 3.09375 -0.71875 C 2.734375 -0.546875 2.296875 -0.546875 2.21875 -0.546875 C 1.59375 -0.546875 1.1875 -0.890625 1.1875 -1.28125 C 1.1875 -1.765625 2.046875 -2.140625 3.484375 -2.171875 Z M 3.484375 -1.328125 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050699-0-3\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.65625 -0.296875 C 4.65625 -0.609375 4.421875 -0.609375 4.25 -0.609375 L 2.953125 -0.609375 L 2.953125 -5.6875 C 2.953125 -5.984375 2.90625 -6.09375 2.5625 -6.09375 L 0.984375 -6.09375 C 0.828125 -6.09375 0.578125 -6.09375 0.578125 -5.78125 C 0.578125 -5.484375 0.84375 -5.484375 0.984375 -5.484375 L 2.265625 -5.484375 L 2.265625 -0.609375 L 0.984375 -0.609375 C 0.828125 -0.609375 0.578125 -0.609375 0.578125 -0.296875 C 0.578125 0 0.84375 0 0.984375 0 L 4.25 0 C 4.40625 0 4.65625 0 4.65625 -0.296875 Z M 4.65625 -0.296875 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050699-0-4\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.84375 -3.046875 C 4.84375 -3.40625 4.5 -3.40625 4.375 -3.40625 L 2.953125 -3.40625 L 2.953125 -4.828125 C 2.953125 -4.9375 2.953125 -5.296875 2.609375 -5.296875 C 2.265625 -5.296875 2.265625 -4.9375 2.265625 -4.828125 L 2.265625 -3.40625 L 0.84375 -3.40625 C 0.734375 -3.40625 0.375 -3.40625 0.375 -3.046875 C 0.375 -2.703125 0.734375 -2.703125 0.84375 -2.703125 L 2.265625 -2.703125 L 2.265625 -1.28125 C 2.265625 -1.15625 2.265625 -0.8125 2.609375 -0.8125 C 2.953125 -0.8125 2.953125 -1.15625 2.953125 -1.28125 L 2.953125 -2.703125 L 4.375 -2.703125 C 4.5 -2.703125 4.84375 -2.703125 4.84375 -3.046875 Z M 4.84375 -3.046875 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050699-0-5\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.9375 -0.296875 C 4.9375 -0.609375 4.6875 -0.609375 4.53125 -0.609375 L 4.140625 -0.609375 L 2.859375 -2.21875 L 4 -3.6875 L 4.390625 -3.6875 C 4.53125 -3.6875 4.8125 -3.6875 4.8125 -3.984375 C 4.8125 -4.296875 4.546875 -4.296875 4.390625 -4.296875 L 3.234375 -4.296875 C 3.078125 -4.296875 2.828125 -4.296875 2.828125 -4 C 2.828125 -3.6875 3.046875 -3.6875 3.3125 -3.6875 L 2.578125 -2.6875 L 1.828125 -3.6875 C 2.078125 -3.6875 2.296875 -3.6875 2.296875 -4 C 2.296875 -4.296875 2.046875 -4.296875 1.90625 -4.296875 L 0.734375 -4.296875 C 0.59375 -4.296875 0.328125 -4.296875 0.328125 -3.984375 C 0.328125 -3.6875 0.59375 -3.6875 0.734375 -3.6875 L 1.140625 -3.6875 L 2.3125 -2.21875 L 1.078125 -0.609375 L 0.671875 -0.609375 C 0.53125 -0.609375 0.265625 -0.609375 0.265625 -0.296875 C 0.265625 0 0.53125 0 0.671875 0 L 1.84375 0 C 2 0 2.25 0 2.25 -0.296875 C 2.25 -0.609375 2.03125 -0.609375 1.71875 -0.609375 L 2.578125 -1.828125 L 3.46875 -0.609375 C 3.1875 -0.609375 2.96875 -0.609375 2.96875 -0.296875 C 2.96875 0 3.21875 0 3.375 0 L 4.53125 0 C 4.671875 0 4.9375 0 4.9375 -0.296875 Z M 4.9375 -0.296875 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050699-0-6\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.703125 -0.40625 L 4.703125 -0.671875 C 4.703125 -0.859375 4.703125 -1.078125 4.359375 -1.078125 C 4.015625 -1.078125 4.015625 -0.890625 4.015625 -0.609375 L 1.640625 -0.609375 C 2.234375 -1.109375 3.1875 -1.859375 3.625 -2.265625 C 4.25 -2.828125 4.703125 -3.453125 4.703125 -4.25 C 4.703125 -5.453125 3.703125 -6.203125 2.484375 -6.203125 C 1.3125 -6.203125 0.515625 -5.390625 0.515625 -4.53125 C 0.515625 -4.171875 0.796875 -4.0625 0.96875 -4.0625 C 1.171875 -4.0625 1.40625 -4.234375 1.40625 -4.5 C 1.40625 -4.625 1.359375 -4.75 1.265625 -4.828125 C 1.421875 -5.28125 1.890625 -5.59375 2.4375 -5.59375 C 3.25 -5.59375 4.015625 -5.140625 4.015625 -4.25 C 4.015625 -3.5625 3.53125 -2.984375 2.875 -2.4375 L 0.671875 -0.578125 C 0.578125 -0.5 0.515625 -0.453125 0.515625 -0.3125 C 0.515625 0 0.765625 0 0.921875 0 L 4.3125 0 C 4.640625 0 4.703125 -0.09375 4.703125 -0.40625 Z M 4.703125 -0.40625 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050699-0-7\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.984375 -3.984375 C 4.984375 -4.296875 4.75 -4.296875 4.578125 -4.296875 L 3.421875 -4.296875 C 3.265625 -4.296875 3.015625 -4.296875 3.015625 -4 C 3.015625 -3.6875 3.265625 -3.6875 3.421875 -3.6875 L 3.703125 -3.6875 L 2.984375 -1.5625 C 2.84375 -1.203125 2.796875 -1.015625 2.71875 -0.703125 C 2.65625 -0.890625 2.578125 -1.109375 2.5 -1.296875 L 1.578125 -3.6875 L 1.828125 -3.6875 C 1.96875 -3.6875 2.21875 -3.6875 2.21875 -3.984375 C 2.21875 -4.296875 1.984375 -4.296875 1.828125 -4.296875 L 0.65625 -4.296875 C 0.5 -4.296875 0.265625 -4.296875 0.265625 -3.984375 C 0.265625 -3.6875 0.515625 -3.6875 0.65625 -3.6875 L 0.96875 -3.6875 L 2.375 -0.125 C 2.421875 -0.03125 2.421875 0 2.421875 0 C 2.421875 0 2.171875 0.84375 2.046875 1.09375 C 1.75 1.640625 1.390625 1.65625 1.25 1.671875 C 1.25 1.671875 1.296875 1.578125 1.296875 1.453125 C 1.296875 1.203125 1.109375 1.015625 0.875 1.015625 C 0.59375 1.015625 0.421875 1.203125 0.421875 1.453125 C 0.421875 1.875 0.765625 2.265625 1.25 2.265625 C 2.25 2.265625 2.703125 0.953125 2.734375 0.84375 L 4.28125 -3.6875 L 4.578125 -3.6875 C 4.734375 -3.6875 4.984375 -3.6875 4.984375 -3.984375 Z M 4.984375 -3.984375 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050699-1-0\">\n",
       "<path style=\"stroke:none;\" d=\"\"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050699-1-1\">\n",
       "<path style=\"stroke:none;\" d=\"M 5.59375 -5.828125 L 2.765625 -7.421875 L -0.046875 -5.828125 L 0.0625 -5.609375 L 2.765625 -6.828125 L 5.46875 -5.609375 Z M 5.59375 -5.828125 \"/>\n",
       "</symbol>\n",
       "</g>\n",
       "</defs>\n",
       "<g id=\"surface1\">\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -6.594375 -6.594281 L -21.887344 -21.88725 \" transform=\"matrix(1,0,0,-1,48.61,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.196591 1.593601 C -1.097139 0.996994 -0.000565833 0.0993475 0.297742 -0.0000790816 C -0.000560208 -0.0995226 -1.097082 -0.997231 -1.1965 -1.593844 \" transform=\"matrix(-0.70714,0.7071,0.7071,0.70714,26.72232,28.28171)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -0.000625 -6.594281 L -0.000625 -21.2935 \" transform=\"matrix(1,0,0,-1,48.61,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.196992 1.593125 C -1.09543 0.995469 -0.00168 0.100938 0.299101 -0.000625 C -0.00168 -0.0982812 -1.09543 -0.996719 -1.196992 -1.594375 \" transform=\"matrix(0,1,1,0,48.61,27.68918)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 13.186875 -6.594281 L 43.097031 -21.547406 \" transform=\"matrix(1,0,0,-1,48.61,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.195423 1.595959 C -1.095853 0.995008 -0.00226986 0.100559 0.296458 0.000980672 C 0.00122226 -0.0985928 -1.09587 -0.996515 -1.195452 -1.592224 \" transform=\"matrix(0.89442,0.4472,0.4472,-0.89442,91.70706,27.94252)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -9.89125 -34.941938 L -35.848281 -52.246625 \" transform=\"matrix(1,0,0,-1,48.61,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.194012 1.592823 C -1.094642 0.997699 0.00056455 0.0990788 0.298667 -0.00136703 C -0.00159451 -0.100736 -1.094631 -0.996128 -1.193995 -1.594493 \" transform=\"matrix(-0.83461,0.5564,0.5564,0.83461,12.76175,58.63965)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -3.2975 -34.941938 L -11.133437 -50.613813 \" transform=\"matrix(1,0,0,-1,48.61,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.195272 1.595692 C -1.096108 0.997129 0.0000689586 0.100999 0.299346 -0.00166894 C 0.0000636106 -0.099101 -1.096161 -0.995172 -1.197097 -1.59373 \" transform=\"matrix(-0.44897,0.898,0.898,0.44897,37.47574,57.00928)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 3.29625 -34.941938 L 10.659531 -49.664594 \" transform=\"matrix(1,0,0,-1,48.61,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.195578 1.593796 C -1.096008 0.99809 0.00105856 0.100156 0.299783 -0.00116879 C 0.00105676 -0.100741 -1.097773 -0.996909 -1.195607 -1.59436 \" transform=\"matrix(0.44722,0.89442,0.89442,-0.44722,59.26932,56.05947)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 53.397813 -34.941938 L 46.339219 -49.059125 \" transform=\"matrix(1,0,0,-1,48.61,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.197642 1.594822 C -1.094577 0.995618 -0.000994158 0.101169 0.297733 0.00159056 C -0.000995955 -0.0997299 -1.094595 -0.995905 -1.19767 -1.593361 \" transform=\"matrix(-0.4472,0.89442,0.89442,0.4472,94.94813,55.45174)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 59.991563 -34.941938 L 67.261094 -49.481 \" transform=\"matrix(1,0,0,-1,48.61,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.193541 1.59417 C -1.096102 0.997358 0.0000835189 0.101269 0.29762 0.00035078 C 0.0000835189 -0.098828 -1.096102 -0.994916 -1.195281 -1.593469 \" transform=\"matrix(0.449,0.898,0.898,-0.449,115.86996,55.87352)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 66.585313 -34.941938 L 92.694688 -52.348188 \" transform=\"matrix(1,0,0,-1,48.61,6.394)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.196095 1.594744 C -1.096731 0.996379 0.00170552 0.0999062 0.298727 -0.00162298 C -0.00153582 -0.0988285 -1.096742 -0.997449 -1.196113 -1.592573 \" transform=\"matrix(0.83461,0.5564,0.5564,-0.83461,141.30627,58.74259)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050699-0-1\" x=\"38.149\" y=\"9.408\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050699-0-2\" x=\"43.379386\" y=\"9.408\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050699-0-3\" x=\"48.609772\" y=\"9.408\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050699-0-3\" x=\"53.840158\" y=\"9.408\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050699-0-4\" x=\"17.648\" y=\"37.386\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050699-0-1\" x=\"38.149\" y=\"37.755\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050699-0-2\" x=\"43.379386\" y=\"37.755\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050699-0-3\" x=\"48.609772\" y=\"37.755\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050699-0-3\" x=\"53.840158\" y=\"37.755\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050699-1-1\" x=\"3.321\" y=\"66.793\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050699-0-5\" x=\"31.821\" y=\"65.234\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050699-0-6\" x=\"60.168\" y=\"66.186\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050699-0-1\" x=\"94.842\" y=\"37.755\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050699-0-2\" x=\"100.072386\" y=\"37.755\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050699-0-3\" x=\"105.302772\" y=\"37.755\"/>\n",
       "  <use xlink:href=\"#glyph-1485466051050699-0-3\" x=\"110.533158\" y=\"37.755\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050699-1-1\" x=\"88.36\" y=\"66.793\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050699-0-7\" x=\"116.861\" y=\"64.099\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050699-0-6\" x=\"145.207\" y=\"66.186\"/>\n",
       "</g>\n",
       "</g>\n",
       "</svg>\n",
       "\n"
      ],
      "text/plain": [
       "TreeView.LabelledTree({10, 9} directed graph,Any[:call,:+,:call,:^,:x,2,:call,:^,:y,2])"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "@tree_with_call x^2 + y^2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Directed Acyclic Graphs (DAGs)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Directed Acyclic Graphs (DAGs) give a higher-level view of the graph, with less Julia-specific detail."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "In the following, the expression `x+y` is repeated twice:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"68.719pt\" height=\"97.608pt\" viewBox=\"0 0 68.719 97.608\" version=\"1.1\">\n",
       "<defs>\n",
       "<g>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050704-0-0\">\n",
       "<path style=\"stroke:none;\" d=\"\"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050704-0-1\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.84375 -3.046875 C 4.84375 -3.40625 4.5 -3.40625 4.375 -3.40625 L 2.953125 -3.40625 L 2.953125 -4.828125 C 2.953125 -4.9375 2.953125 -5.296875 2.609375 -5.296875 C 2.265625 -5.296875 2.265625 -4.9375 2.265625 -4.828125 L 2.265625 -3.40625 L 0.84375 -3.40625 C 0.734375 -3.40625 0.375 -3.40625 0.375 -3.046875 C 0.375 -2.703125 0.734375 -2.703125 0.84375 -2.703125 L 2.265625 -2.703125 L 2.265625 -1.28125 C 2.265625 -1.15625 2.265625 -0.8125 2.609375 -0.8125 C 2.953125 -0.8125 2.953125 -1.15625 2.953125 -1.28125 L 2.953125 -2.703125 L 4.375 -2.703125 C 4.5 -2.703125 4.84375 -2.703125 4.84375 -3.046875 Z M 4.84375 -3.046875 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050704-0-2\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.9375 -0.296875 C 4.9375 -0.609375 4.6875 -0.609375 4.53125 -0.609375 L 4.140625 -0.609375 L 2.859375 -2.21875 L 4 -3.6875 L 4.390625 -3.6875 C 4.53125 -3.6875 4.8125 -3.6875 4.8125 -3.984375 C 4.8125 -4.296875 4.546875 -4.296875 4.390625 -4.296875 L 3.234375 -4.296875 C 3.078125 -4.296875 2.828125 -4.296875 2.828125 -4 C 2.828125 -3.6875 3.046875 -3.6875 3.3125 -3.6875 L 2.578125 -2.6875 L 1.828125 -3.6875 C 2.078125 -3.6875 2.296875 -3.6875 2.296875 -4 C 2.296875 -4.296875 2.046875 -4.296875 1.90625 -4.296875 L 0.734375 -4.296875 C 0.59375 -4.296875 0.328125 -4.296875 0.328125 -3.984375 C 0.328125 -3.6875 0.59375 -3.6875 0.734375 -3.6875 L 1.140625 -3.6875 L 2.3125 -2.21875 L 1.078125 -0.609375 L 0.671875 -0.609375 C 0.53125 -0.609375 0.265625 -0.609375 0.265625 -0.296875 C 0.265625 0 0.53125 0 0.671875 0 L 1.84375 0 C 2 0 2.25 0 2.25 -0.296875 C 2.25 -0.609375 2.03125 -0.609375 1.71875 -0.609375 L 2.578125 -1.828125 L 3.46875 -0.609375 C 3.1875 -0.609375 2.96875 -0.609375 2.96875 -0.296875 C 2.96875 0 3.21875 0 3.375 0 L 4.53125 0 C 4.671875 0 4.9375 0 4.9375 -0.296875 Z M 4.9375 -0.296875 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050704-0-3\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.984375 -3.984375 C 4.984375 -4.296875 4.75 -4.296875 4.578125 -4.296875 L 3.421875 -4.296875 C 3.265625 -4.296875 3.015625 -4.296875 3.015625 -4 C 3.015625 -3.6875 3.265625 -3.6875 3.421875 -3.6875 L 3.703125 -3.6875 L 2.984375 -1.5625 C 2.84375 -1.203125 2.796875 -1.015625 2.71875 -0.703125 C 2.65625 -0.890625 2.578125 -1.109375 2.5 -1.296875 L 1.578125 -3.6875 L 1.828125 -3.6875 C 1.96875 -3.6875 2.21875 -3.6875 2.21875 -3.984375 C 2.21875 -4.296875 1.984375 -4.296875 1.828125 -4.296875 L 0.65625 -4.296875 C 0.5 -4.296875 0.265625 -4.296875 0.265625 -3.984375 C 0.265625 -3.6875 0.515625 -3.6875 0.65625 -3.6875 L 0.96875 -3.6875 L 2.375 -0.125 C 2.421875 -0.03125 2.421875 0 2.421875 0 C 2.421875 0 2.171875 0.84375 2.046875 1.09375 C 1.75 1.640625 1.390625 1.65625 1.25 1.671875 C 1.25 1.671875 1.296875 1.578125 1.296875 1.453125 C 1.296875 1.203125 1.109375 1.015625 0.875 1.015625 C 0.59375 1.015625 0.421875 1.203125 0.421875 1.453125 C 0.421875 1.875 0.765625 2.265625 1.25 2.265625 C 2.25 2.265625 2.703125 0.953125 2.734375 0.84375 L 4.28125 -3.6875 L 4.578125 -3.6875 C 4.734375 -3.6875 4.984375 -3.6875 4.984375 -3.984375 Z M 4.984375 -3.984375 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050704-0-4\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.703125 -0.40625 L 4.703125 -0.671875 C 4.703125 -0.859375 4.703125 -1.078125 4.359375 -1.078125 C 4.015625 -1.078125 4.015625 -0.890625 4.015625 -0.609375 L 1.640625 -0.609375 C 2.234375 -1.109375 3.1875 -1.859375 3.625 -2.265625 C 4.25 -2.828125 4.703125 -3.453125 4.703125 -4.25 C 4.703125 -5.453125 3.703125 -6.203125 2.484375 -6.203125 C 1.3125 -6.203125 0.515625 -5.390625 0.515625 -4.53125 C 0.515625 -4.171875 0.796875 -4.0625 0.96875 -4.0625 C 1.171875 -4.0625 1.40625 -4.234375 1.40625 -4.5 C 1.40625 -4.625 1.359375 -4.75 1.265625 -4.828125 C 1.421875 -5.28125 1.890625 -5.59375 2.4375 -5.59375 C 3.25 -5.59375 4.015625 -5.140625 4.015625 -4.25 C 4.015625 -3.5625 3.53125 -2.984375 2.875 -2.4375 L 0.671875 -0.578125 C 0.578125 -0.5 0.515625 -0.453125 0.515625 -0.3125 C 0.515625 0 0.765625 0 0.921875 0 L 4.3125 0 C 4.640625 0 4.703125 -0.09375 4.703125 -0.40625 Z M 4.703125 -0.40625 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050704-1-0\">\n",
       "<path style=\"stroke:none;\" d=\"\"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050704-1-1\">\n",
       "<path style=\"stroke:none;\" d=\"M 5.59375 -5.828125 L 2.765625 -7.421875 L -0.046875 -5.828125 L 0.0625 -5.609375 L 2.765625 -6.828125 L 5.46875 -5.609375 Z M 5.59375 -5.828125 \"/>\n",
       "</symbol>\n",
       "</g>\n",
       "</defs>\n",
       "<g id=\"surface1\">\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -6.136219 -6.136563 L -21.733875 -21.734219 \" transform=\"matrix(1,0,0,-1,34.437,5.965)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.194946 1.594011 C -1.095508 0.997384 0.00107039 0.0996809 0.299384 0.00024307 C 0.00107039 -0.0991948 -1.095508 -0.996898 -1.194946 -1.593525 \" transform=\"matrix(-0.7071,0.7071,0.7071,0.7071,12.70371,27.69829)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 0.0005 -6.163906 L 0.0005 -50.070156 \" transform=\"matrix(1,0,0,-1,34.437,5.965)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.195556 1.59425 C -1.093994 0.996594 -0.00024375 0.0981563 0.300538 0.0005 C -0.00024375 -0.101062 -1.093994 -0.995594 -1.195556 -1.59325 \" transform=\"matrix(0,1,1,0,34.437,56.0354)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -28.347156 -35.574063 L -28.347156 -50.070156 \" transform=\"matrix(1,0,0,-1,34.437,5.965)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.195556 1.593394 C -1.093994 0.995738 -0.00024375 0.101206 0.300538 -0.00035625 C -0.00024375 -0.0980125 -1.093994 -0.99645 -1.195556 -1.594106 \" transform=\"matrix(0,1,1,0,6.0902,56.0354)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -22.058094 -31.492031 L 21.801281 -53.421719 \" transform=\"matrix(1,0,0,-1,34.437,5.965)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.195181 1.594124 C -1.097337 0.99668 0.00149881 0.10054 0.300225 0.000974032 C 0.0015042 -0.100355 -1.097284 -0.994807 -1.195095 -1.594003 \" transform=\"matrix(0.89442,0.44724,0.44724,-0.89442,56.23885,59.38613)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -28.347156 -62.859219 L -28.347156 -78.913906 \" transform=\"matrix(1,0,0,-1,34.437,5.965)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.196746 1.593394 C -1.095184 0.995738 -0.00143375 0.101206 0.299348 -0.00035625 C -0.00143375 -0.0980125 -1.095184 -0.99645 -1.196746 -1.594106 \" transform=\"matrix(0,1,1,0,6.0902,84.88034)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -22.210437 -62.827969 L -6.460437 -78.581875 \" transform=\"matrix(1,0,0,-1,34.437,5.965)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.196589 1.592418 C -1.097147 0.995788 -0.000554014 0.0980862 0.297762 -0.00135026 C -0.000552608 -0.100791 -1.09437 -0.995746 -1.196567 -1.59514 \" transform=\"matrix(0.70709,0.7071,0.7071,-0.70709,27.97791,84.54631)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -6.136219 -62.827969 L -22.354969 -79.050625 \" transform=\"matrix(1,0,0,-1,34.437,5.965)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.195968 1.595107 C -1.093754 0.995738 0.0000563666 0.100854 0.298364 0.00142705 C 0.0000619914 -0.0980164 -1.09646 -0.995725 -1.195878 -1.592338 \" transform=\"matrix(-0.70714,0.7071,0.7071,0.70714,12.08107,85.01458)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 0.0005 -62.859219 L 0.0005 -77.781094 \" transform=\"matrix(1,0,0,-1,34.437,5.965)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.193789 1.59425 C -1.096132 0.996594 0.00152375 0.0981563 0.298399 0.0005 C 0.00152375 -0.101062 -1.096132 -0.995594 -1.193789 -1.59325 \" transform=\"matrix(0,1,1,0,34.437,83.74457)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050704-0-1\" x=\"31.821\" y=\"8.611\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050704-1-1\" x=\"3.321\" y=\"38.018\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050704-0-1\" x=\"3.475\" y=\"65.303\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050704-0-2\" x=\"3.475\" y=\"93.152\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050704-0-3\" x=\"31.821\" y=\"92.016\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050704-0-4\" x=\"60.168\" y=\"65.757\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050704-0-1\" x=\"31.821\" y=\"65.303\"/>\n",
       "</g>\n",
       "</g>\n",
       "</svg>\n",
       "\n"
      ],
      "text/plain": [
       "TreeView.DirectedAcyclicGraph({7, 8} directed graph,Any[:+,:^,:+,:x,:y,2,:+],Dict(:y=>5,:x=>4))"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "@dag (x + y)^2 + (x + y)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can apply **Common Subexpression Elimination** (CSE) from the [`CommonSubexpressions.jl` package](https://github.com/rdeits/CommonSubexpressions.jl/):"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"54.546pt\" height=\"97.608pt\" viewBox=\"0 0 54.546 97.608\" version=\"1.1\">\n",
       "<defs>\n",
       "<g>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050705-0-0\">\n",
       "<path style=\"stroke:none;\" d=\"\"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050705-0-1\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.84375 -3.046875 C 4.84375 -3.40625 4.5 -3.40625 4.375 -3.40625 L 2.953125 -3.40625 L 2.953125 -4.828125 C 2.953125 -4.9375 2.953125 -5.296875 2.609375 -5.296875 C 2.265625 -5.296875 2.265625 -4.9375 2.265625 -4.828125 L 2.265625 -3.40625 L 0.84375 -3.40625 C 0.734375 -3.40625 0.375 -3.40625 0.375 -3.046875 C 0.375 -2.703125 0.734375 -2.703125 0.84375 -2.703125 L 2.265625 -2.703125 L 2.265625 -1.28125 C 2.265625 -1.15625 2.265625 -0.8125 2.609375 -0.8125 C 2.953125 -0.8125 2.953125 -1.15625 2.953125 -1.28125 L 2.953125 -2.703125 L 4.375 -2.703125 C 4.5 -2.703125 4.84375 -2.703125 4.84375 -3.046875 Z M 4.84375 -3.046875 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050705-0-2\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.9375 -0.296875 C 4.9375 -0.609375 4.6875 -0.609375 4.53125 -0.609375 L 4.140625 -0.609375 L 2.859375 -2.21875 L 4 -3.6875 L 4.390625 -3.6875 C 4.53125 -3.6875 4.8125 -3.6875 4.8125 -3.984375 C 4.8125 -4.296875 4.546875 -4.296875 4.390625 -4.296875 L 3.234375 -4.296875 C 3.078125 -4.296875 2.828125 -4.296875 2.828125 -4 C 2.828125 -3.6875 3.046875 -3.6875 3.3125 -3.6875 L 2.578125 -2.6875 L 1.828125 -3.6875 C 2.078125 -3.6875 2.296875 -3.6875 2.296875 -4 C 2.296875 -4.296875 2.046875 -4.296875 1.90625 -4.296875 L 0.734375 -4.296875 C 0.59375 -4.296875 0.328125 -4.296875 0.328125 -3.984375 C 0.328125 -3.6875 0.59375 -3.6875 0.734375 -3.6875 L 1.140625 -3.6875 L 2.3125 -2.21875 L 1.078125 -0.609375 L 0.671875 -0.609375 C 0.53125 -0.609375 0.265625 -0.609375 0.265625 -0.296875 C 0.265625 0 0.53125 0 0.671875 0 L 1.84375 0 C 2 0 2.25 0 2.25 -0.296875 C 2.25 -0.609375 2.03125 -0.609375 1.71875 -0.609375 L 2.578125 -1.828125 L 3.46875 -0.609375 C 3.1875 -0.609375 2.96875 -0.609375 2.96875 -0.296875 C 2.96875 0 3.21875 0 3.375 0 L 4.53125 0 C 4.671875 0 4.9375 0 4.9375 -0.296875 Z M 4.9375 -0.296875 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050705-0-3\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.984375 -3.984375 C 4.984375 -4.296875 4.75 -4.296875 4.578125 -4.296875 L 3.421875 -4.296875 C 3.265625 -4.296875 3.015625 -4.296875 3.015625 -4 C 3.015625 -3.6875 3.265625 -3.6875 3.421875 -3.6875 L 3.703125 -3.6875 L 2.984375 -1.5625 C 2.84375 -1.203125 2.796875 -1.015625 2.71875 -0.703125 C 2.65625 -0.890625 2.578125 -1.109375 2.5 -1.296875 L 1.578125 -3.6875 L 1.828125 -3.6875 C 1.96875 -3.6875 2.21875 -3.6875 2.21875 -3.984375 C 2.21875 -4.296875 1.984375 -4.296875 1.828125 -4.296875 L 0.65625 -4.296875 C 0.5 -4.296875 0.265625 -4.296875 0.265625 -3.984375 C 0.265625 -3.6875 0.515625 -3.6875 0.65625 -3.6875 L 0.96875 -3.6875 L 2.375 -0.125 C 2.421875 -0.03125 2.421875 0 2.421875 0 C 2.421875 0 2.171875 0.84375 2.046875 1.09375 C 1.75 1.640625 1.390625 1.65625 1.25 1.671875 C 1.25 1.671875 1.296875 1.578125 1.296875 1.453125 C 1.296875 1.203125 1.109375 1.015625 0.875 1.015625 C 0.59375 1.015625 0.421875 1.203125 0.421875 1.453125 C 0.421875 1.875 0.765625 2.265625 1.25 2.265625 C 2.25 2.265625 2.703125 0.953125 2.734375 0.84375 L 4.28125 -3.6875 L 4.578125 -3.6875 C 4.734375 -3.6875 4.984375 -3.6875 4.984375 -3.984375 Z M 4.984375 -3.984375 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050705-0-4\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.703125 -0.40625 L 4.703125 -0.671875 C 4.703125 -0.859375 4.703125 -1.078125 4.359375 -1.078125 C 4.015625 -1.078125 4.015625 -0.890625 4.015625 -0.609375 L 1.640625 -0.609375 C 2.234375 -1.109375 3.1875 -1.859375 3.625 -2.265625 C 4.25 -2.828125 4.703125 -3.453125 4.703125 -4.25 C 4.703125 -5.453125 3.703125 -6.203125 2.484375 -6.203125 C 1.3125 -6.203125 0.515625 -5.390625 0.515625 -4.53125 C 0.515625 -4.171875 0.796875 -4.0625 0.96875 -4.0625 C 1.171875 -4.0625 1.40625 -4.234375 1.40625 -4.5 C 1.40625 -4.625 1.359375 -4.75 1.265625 -4.828125 C 1.421875 -5.28125 1.890625 -5.59375 2.4375 -5.59375 C 3.25 -5.59375 4.015625 -5.140625 4.015625 -4.25 C 4.015625 -3.5625 3.53125 -2.984375 2.875 -2.4375 L 0.671875 -0.578125 C 0.578125 -0.5 0.515625 -0.453125 0.515625 -0.3125 C 0.515625 0 0.765625 0 0.921875 0 L 4.3125 0 C 4.640625 0 4.703125 -0.09375 4.703125 -0.40625 Z M 4.703125 -0.40625 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050705-1-0\">\n",
       "<path style=\"stroke:none;\" d=\"\"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph-1485466051050705-1-1\">\n",
       "<path style=\"stroke:none;\" d=\"M 5.59375 -5.828125 L 2.765625 -7.421875 L -0.046875 -5.828125 L 0.0625 -5.609375 L 2.765625 -6.828125 L 5.46875 -5.609375 Z M 5.59375 -5.828125 \"/>\n",
       "</symbol>\n",
       "</g>\n",
       "</defs>\n",
       "<g id=\"surface1\">\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -3.083312 -6.166219 L -11.134094 -22.267781 \" transform=\"matrix(1,0,0,-1,20.263,62.658)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.194308 1.595405 C -1.095134 0.996849 0.00104879 0.100747 0.298585 0.00156528 C 0.001047 -0.0993512 -1.095152 -0.995434 -1.196076 -1.593988 \" transform=\"matrix(-0.44899,0.898,0.898,0.44899,9.12875,84.92648)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 3.08075 -6.166219 L 10.569031 -21.134969 \" transform=\"matrix(1,0,0,-1,20.263,62.658)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.193494 1.594621 C -1.095671 0.995421 -0.00209823 0.0992343 0.298374 0.00140326 C -0.00035306 -0.0981693 -1.095689 -0.996084 -1.193523 -1.593534 \" transform=\"matrix(0.44722,0.89442,0.89442,-0.44722,30.83015,83.79235)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -10.559875 21.118937 L -3.286437 6.575969 \" transform=\"matrix(1,0,0,-1,20.263,62.658)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.195543 1.594569 C -1.097708 0.995366 0.00113112 0.100937 0.29986 -0.000383044 C 0.00113292 -0.0999619 -1.097691 -0.996157 -1.195514 -1.593615 \" transform=\"matrix(0.4472,0.89442,0.89442,-0.4472,16.97562,56.08319)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -7.884094 24.154094 L 21.83075 4.3455 \" transform=\"matrix(1,0,0,-1,20.263,62.658)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.196842 1.594269 C -1.09746 0.995921 0.000981569 0.0995045 0.298 -0.00201259 C -0.00225311 -0.0992259 -1.094165 -0.995703 -1.196754 -1.592977 \" transform=\"matrix(0.83461,0.55644,0.55644,-0.83461,42.09225,58.31297)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 14.1745 50.529094 L 14.1745 28.3455 L 3.287781 6.575969 \" transform=\"matrix(1,0,0,-1,20.263,62.658)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.196124 1.594763 C -1.096544 0.993819 0.000539108 0.101145 0.299266 0.0015724 C 0.000540905 -0.0997525 -1.096526 -0.997687 -1.196096 -1.593392 \" transform=\"matrix(-0.44722,0.89442,0.89442,0.44722,23.5504,56.08319)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 8.037781 50.560344 L -7.559875 34.958781 \" transform=\"matrix(1,0,0,-1,20.263,62.658)\"/>\n",
       "<path style=\"fill:none;stroke-width:0.31879;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M -1.194946 1.594859 C -1.095508 0.998232 0.00107039 0.100529 0.299384 0.00109161 C 0.00107039 -0.0983462 -1.095508 -0.996049 -1.194946 -1.592676 \" transform=\"matrix(-0.7071,0.7071,0.7071,0.7071,12.70311,27.69769)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050705-0-1\" x=\"17.648\" y=\"65.303\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050705-0-2\" x=\"3.475\" y=\"93.152\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050705-0-3\" x=\"31.821\" y=\"92.016\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050705-1-1\" x=\"3.321\" y=\"38.018\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050705-0-4\" x=\"45.995\" y=\"65.757\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph-1485466051050705-0-1\" x=\"31.821\" y=\"8.611\"/>\n",
       "</g>\n",
       "</g>\n",
       "</svg>\n",
       "\n"
      ],
      "text/plain": [
       "TreeView.DirectedAcyclicGraph({6, 6} directed graph,Any[:+,:x,:y,:^,2,:+],Dict(Symbol(\"##^#271\")=>4,Symbol(\"##+#272\")=>6,:y=>3,:x=>2,Symbol(\"##+#270\")=>1))"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "@dag_cse (x + y)^2 + (x + y)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We see that the common subexpression `x+y` now appears only once."
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Julia 0.5.0",
   "language": "julia",
   "name": "julia-0.5"
  },
  "language_info": {
   "file_extension": ".jl",
   "mimetype": "application/julia",
   "name": "julia",
   "version": "0.5.0"
  },
  "toc": {
   "nav_menu": {
    "height": "12px",
    "width": "252px"
   },
   "navigate_menu": true,
   "number_sections": true,
   "sideBar": true,
   "threshold": "2",
   "toc_cell": false,
   "toc_section_display": "block",
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
